package com.security.user.mapper;

import com.security.user.model.UserInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * @Author yanggld
 * @Date 2020/3/9-15:15
 */
public interface UserInfoMapper {

    @Select("select * from user_info where id = #{id}")
    UserInfo getById(@Param("id") Long id);

    @Insert("insert into user_info(username,password) values(#{username},#{password})")
    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    int save(UserInfo userInfo);

    @Select("select * from user_info where username = #{username}")
    UserInfo findByUsername(@Param("username") String username);
}
